﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>员工面板</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    
    <script src="../scripts/boot.js" type="text/javascript"></script>
    <script src="../js/json2.js" type="text/javascript"></script>
    

    <style type="text/css">
    html, body
    {
        font-size:12px;
        padding:0;
        margin:0;
        border:0;
        height:100%;
        overflow:hidden;
    }
    </style>
</head>
<body>    
     
    <form id="form1" method="post">
        <input name="id" class="mini-hidden" />
        <div style="padding-left:11px;padding-bottom:5px;">
            <table style="table-layout:fixed;">
                <tr>
                    <td style="width:90px;">帐号：</td>
                    <td style="width:250px;" id="username" >    
                        <input style="width:250px;" readonly="readonly" name="username" class="mini-textbox" required="true"  emptyText="请输入帐号"/>
                    </td>
                </tr>
                <tr>
                    <td style="width:90px;">密码：</td>
                    <td style="width:250px;">    
                        <input style="width:250px;" name="password" class="mini-textbox" required="true"  emptyText="请输入密码"/>
                    </td>
                </tr>
                <tr>
                    <td style="width:90px;">appURL：</td>
                    <td style="width:250px;">    
                        <input style="width:250px;" name="appURL" class="mini-textbox"  onvaluechanged="onDeptChanged" required="true"  emptyText="请输入应用地址"/>
                    </td>
                </tr>
                <tr>
                    <td style="width:90px;">通过审核：</td>
					<td style="width:250px;">
						<div style="width:250px;" id="queryRight" name="queryRight"
							class="mini-radiobuttonlist" textField="id" valueField="id"
							value="no" url="data/queryRights.txt"></div></td>
				</tr>
        </table>            
            </div>
        </fieldset>
        <div style="text-align:center;padding:10px;">               
            <a class="mini-button" onclick="onOk" style="width:60px;margin-right:20px;">确定</a>       
            <a class="mini-button" onclick="onCancel" style="width:60px;">取消</a>       
        </div>        
    </form>
    <script type="text/javascript">
        mini.parse();
        var action = ""

        var form = new mini.Form("form1");

        function SaveData() {
            var o = form.getData();            

            form.validate();
            if (form.isValid() == false) return;

            var json = mini.encode(o);
            $.ajax({
                url: "../admin/admin_"+ action,
				type: 'post',
                data: { data: json },
                dataType:"json",
                cache: false,
                success: function (obj) {
                	//var obj=eval("("+text+")");
                	if(obj.result == "success"){
                		mini.alert("success","edit",function(){CloseWindow("save")});
                    }
                    else
                    	mini.alert(obj.data);
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    mini.alert(jqXHR.responseText);
                    CloseWindow();
                }
            });
        }

        ////////////////////
        //标准方法接口定义
        function SetData(data) {
            if (data.action == "edit") {
                //跨页面传递的数据对象，克隆后才可以安全使用
                data = mini.clone(data);

                $.ajax({
                    url: "../admin/admin_getUser?username=" + data.username,
                    cache: false,
                    dataType:"json",
                    success: function (text) {
                        var o = mini.decode(text);
                        form.setData(o);
                    }
                });
                $("#username").after("<td><p style=\"color: red;dispaly:inline;\">账户名不可修改</p></td>");
                $("#username > input").keypress(function(){
                	return false;
                });
                action = "updateUser"
            }else
            	action = "addUser"
        }
        
        function onOk(e) {
            SaveData();
        }
        function onCancel(e) {
            CloseWindow("cancel");
        }
        
        function CloseWindow(action) {            
             if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();
        }



    </script>
</body>
</html>
